from endOfPeriodProject.student.studentManger import *
from endOfPeriodProject.teacher.teacherManger import *
from endOfPeriodProject.user.userManger import *


class AllManger(object):
    def choose(self):
        s_Manager = StudentManager()
        t_Manager = TeacherManger()
        u_Manager = UserManager()
        u_Manager.login_for_all()
        while True:
            try:
                self.question()
                user_input = int(input("what do you want to do?"))
                if user_input == 1:
                    s_Manager.run()
                elif user_input == 2:
                    t_Manager.run()
                elif user_input == 3:
                    u_Manager.run()
                elif user_input == 4:
                    print("\033[47m ------Thank you for your ues!!!------ \033[0m")
                    break
                else:
                    print("\033[31m unknown enter, please try again\033[0m")
                    self.question()
                    self.choose()
            except ValueError:
                print("\033[31m unknown enter, please try again\033[0m")
                self.question()
                self.choose()

    def question(self):
        print("\033[34m 1.Student manger system\033[0m\n"
              "\033[34m 2.Teacher manger system\033[0m\n"
              "\033[34m 3.User manger system\033[0m\n"
              "\033[34m 4.Edit\033[0m")